#!/usr/bin/env python3
from boututils.run_wrapper import shell, shell_safe

#requires: all_tests

print("Making test-attribs test")
shell_safe("make > make.log")

shell_safe("./test-attribs")

# Read the attributes

from boutdata import attributes

success = True

# Get attributes for 2D field variable "g12"

attr = attributes("g12", path="data")

if attr['value'] != 42:
    print("Field2D integer attribute FAIL. Attributes: ", attr)
    success = False

# Get attributes for 3D field variable "a"
    
attr = attributes("a", path="data")
if attr['meta'] != "something useful":
    print("Field3D integer attribute FAIL. Attributes: ", attr)
    success = False

if success:
    print("Passed")
    exit(0)

print("Failed")
exit(1)
